<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/limh/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/limh/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/limh/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/limh/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/limh/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/limh/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/limh/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="教程,">










<meta name="description" content="简介math.h 头文件定义了各种数学函数和一个宏。在这个库中所有可用的功能都带有一个 double 类型的参数，且都返回 double 类型的结果。 库宏下面是这个库中定义的唯一的一个宏：    序号 宏 &amp;amp; 描述     1 HUGE_VAL  当函数的结果不可以表示为浮点数时。如果是因为结果的幅度太大以致于无法表示，则函数会设置 errno 为 ERANGE 来表示范围错误，并返回一">
<meta name="keywords" content="教程">
<meta property="og:type" content="article">
<meta property="og:title" content="math.h">
<meta property="og:url" content="https://tdnr.gitee.io/limh/2015/03/07/cfunc07/index.html">
<meta property="og:site_name" content="土逗牛肉">
<meta property="og:description" content="简介math.h 头文件定义了各种数学函数和一个宏。在这个库中所有可用的功能都带有一个 double 类型的参数，且都返回 double 类型的结果。 库宏下面是这个库中定义的唯一的一个宏：    序号 宏 &amp;amp; 描述     1 HUGE_VAL  当函数的结果不可以表示为浮点数时。如果是因为结果的幅度太大以致于无法表示，则函数会设置 errno 为 ERANGE 来表示范围错误，并返回一">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-01-20T03:31:54.611Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="math.h">
<meta name="twitter:description" content="简介math.h 头文件定义了各种数学函数和一个宏。在这个库中所有可用的功能都带有一个 double 类型的参数，且都返回 double 类型的结果。 库宏下面是这个库中定义的唯一的一个宏：    序号 宏 &amp;amp; 描述     1 HUGE_VAL  当函数的结果不可以表示为浮点数时。如果是因为结果的幅度太大以致于无法表示，则函数会设置 errno 为 ERANGE 来表示范围错误，并返回一">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/limh/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://tdnr.gitee.io/limh/2015/03/07/cfunc07/">





  <title>math.h | 土逗牛肉</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans ">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/limh/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">土逗牛肉</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/limh/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/limh/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/limh/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/limh/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/limh/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tdnr.gitee.io/limh/limh/2015/03/07/cfunc07/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="土逗牛肉">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/limh/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="土逗牛肉">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">math.h</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2015-03-07T20:35:45+08:00">
                2015-03-07
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/limh/categories/C函数库/" itemprop="url" rel="index">
                    <span itemprop="name">C函数库</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>math.h 头文件定义了各种数学函数和一个宏。在这个库中所有可用的功能都带有一个 double 类型的参数，且都返回 double 类型的结果。</p>
<h2 id="库宏"><a href="#库宏" class="headerlink" title="库宏"></a>库宏</h2><p>下面是这个库中定义的唯一的一个宏：</p>
<table>
<thead>
<tr>
<th>序号</th>
<th>宏 &amp; 描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><strong>HUGE_VAL</strong> <br> 当函数的结果不可以表示为浮点数时。如果是因为结果的幅度太大以致于无法表示，则函数会设置 errno 为 ERANGE 来表示范围错误，并返回一个由宏 HUGE_VAL 或者它的否定（- HUGE_VAL）命名的一个特定的很大的值。</td>
</tr>
</tbody>
</table>
<p>如果结果的幅度太小，则会返回零值。在这种情况下，error 可能会被设置为 ERANGE，也有可能不会被设置为 ERANGE。</p>
<h2 id="库函数"><a href="#库函数" class="headerlink" title="库函数"></a>库函数</h2><p>下面列出了头文件 math.h 中定义的函数：</p>
<table>
<thead>
<tr>
<th>序号</th>
<th>函数 &amp; 描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><strong>double acos(double x)</strong> <br> 返回以弧度表示的 x 的反余弦。</td>
</tr>
<tr>
<td>2</td>
<td><strong>double asin(double x)</strong> <br> 返回以弧度表示的 x 的反正弦。</td>
</tr>
<tr>
<td>3</td>
<td><strong>double atan(double x)</strong> <br> 返回以弧度表示的 x 的反正切。</td>
</tr>
<tr>
<td>4</td>
<td><strong>double atan2(double y, double x)</strong> <br> 返回以弧度表示的 y/x 的反正切。y 和 x 的值的符号决定了正确的象限。</td>
</tr>
<tr>
<td>5</td>
<td><strong>double cos(double x)</strong> <br> 返回弧度角 x 的余弦。</td>
</tr>
<tr>
<td>6</td>
<td><strong>double cosh(double x)</strong> <br> 返回 x 的双曲余弦。</td>
</tr>
<tr>
<td>7</td>
<td><strong>double sin(double x)</strong> <br> 返回弧度角 x 的正弦。</td>
</tr>
<tr>
<td>8</td>
<td><strong>double sinh(double x)</strong> <br> 返回 x 的双曲正弦。</td>
</tr>
<tr>
<td>9</td>
<td><strong>double tanh(double x)</strong> <br> 返回 x 的双曲正切。</td>
</tr>
<tr>
<td>10</td>
<td><strong>double exp(double x)</strong> <br> 返回 e 的 x 次幂的值。</td>
</tr>
<tr>
<td>11</td>
<td><strong>double frexp(double x, int &#42;exponent)</strong> <br> 把浮点数 x 分解成尾数和指数。返回值是尾数，并将指数存入 exponent 中。所得的值是 x = mantissa * 2 ^ exponent。</td>
</tr>
<tr>
<td>12</td>
<td><strong>double ldexp(double x, int exponent)</strong> <br> 返回 x 乘以 2 的 exponent 次幂。</td>
</tr>
<tr>
<td>13</td>
<td><strong>double log(double x)</strong> <br> 返回 x 的自然对数（基数为 e 的对数）。</td>
</tr>
<tr>
<td>14</td>
<td><strong>double log10(double x)</strong> <br> 返回 x 的常用对数（基数为 10 的对数）。</td>
</tr>
<tr>
<td>15</td>
<td><strong>double modf(double x, double  &#42;integer)</strong> <br> 返回值为小数部分（小数点后的部分），并设置 integer 为整数部分。</td>
</tr>
<tr>
<td>16</td>
<td><strong>double pow(double x, double y)</strong> <br> 返回 x 的 y 次幂。</td>
</tr>
<tr>
<td>17</td>
<td><strong>double sqrt(double x)</strong> <br> 返回 x 的平方根。</td>
</tr>
<tr>
<td>18</td>
<td><strong>double ceil(double x)</strong> <br> 返回大于或等于 x 的最小的整数值。</td>
</tr>
<tr>
<td>19</td>
<td><strong>double fabs(double x)</strong> <br> 返回 x 的绝对值。</td>
</tr>
<tr>
<td>20</td>
<td><strong>double floor(double x)</strong> <br> 返回小于或等于 x 的最大的整数值。</td>
</tr>
<tr>
<td>21</td>
<td><strong>double fmod(double x, double y)</strong> <br> 返回 x 除以 y 的余数。</td>
</tr>
</tbody>
</table>
<h2 id="函数用例"><a href="#函数用例" class="headerlink" title="函数用例"></a>函数用例</h2><h3 id="一、acos"><a href="#一、acos" class="headerlink" title="一、acos()"></a>一、acos()</h3><h4 id="描述"><a href="#描述" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double acos(double x) 返回以弧度表示的 x 的反余弦。</p>
<h4 id="声明"><a href="#声明" class="headerlink" title="声明"></a>声明</h4><p>下面是 acos() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double acos(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数"><a href="#参数" class="headerlink" title="参数"></a>参数</h4><p>x – 介于 [-1,+1] 区间的浮点值。</p>
<h4 id="返回值"><a href="#返回值" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回以弧度表示的 x 的反余弦，弧度区间为 [0, pi]。</p>
<h4 id="实例"><a href="#实例" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 acos() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">#define PI 3.14159265</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret, val;</span><br><span class="line"></span><br><span class="line">   x = 0.9;</span><br><span class="line">   val = 180.0 / PI;</span><br><span class="line"></span><br><span class="line">   ret = acos(x) * val;</span><br><span class="line">   printf(&quot;%lf 的反余弦是 %lf 度&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>0.900000 的反余弦是 25.855040 度</p>
</blockquote>
<h3 id="二、asin"><a href="#二、asin" class="headerlink" title="二、asin()"></a>二、asin()</h3><h4 id="描述-1"><a href="#描述-1" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double asin(double x) 返回以弧度表示的 x 的反正弦。</p>
<h4 id="声明-1"><a href="#声明-1" class="headerlink" title="声明"></a>声明</h4><p>下面是 asin() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double asin(double x)</span><br></pre></td></tr></table></figure>
<p>####　参数</p>
<p>x – 介于 [-1,+1] 区间的浮点值。</p>
<h4 id="返回值-1"><a href="#返回值-1" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回以弧度表示的 x 的反正弦，弧度区间为 [-pi/2,+pi/2]。</p>
<h4 id="实例-1"><a href="#实例-1" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 asin() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">#define PI 3.14159265</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret, val;</span><br><span class="line">   x = 0.9;</span><br><span class="line">   val = 180.0 / PI;</span><br><span class="line"></span><br><span class="line">   ret = asin(x) * val;</span><br><span class="line">   printf(&quot;%lf 的反正弦是 %lf 度&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>0.900000 的反正弦是 64.190609 度</p>
</blockquote>
<p>###　三、atan()</p>
<h4 id="描述-2"><a href="#描述-2" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double atan(double x) 返回以弧度表示的 x 的反正切。</p>
<h4 id="声明-2"><a href="#声明-2" class="headerlink" title="声明"></a>声明</h4><p>下面是 atan() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double atan(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-1"><a href="#参数-1" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-2"><a href="#返回值-2" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回以弧度表示的 x 的反正切，弧度区间为 [-pi/2,+pi/2]。</p>
<h4 id="实例-2"><a href="#实例-2" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 atan() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">#define PI 3.14159265</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret, val;</span><br><span class="line">   x = 1.0;</span><br><span class="line">   val = 180.0 / PI;</span><br><span class="line"></span><br><span class="line">   ret = atan (x) * val;</span><br><span class="line">   printf(&quot;%lf 的反正切是 %lf 度&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>1.000000 的反正切是 45.000000 度</p>
</blockquote>
<h3 id="四、atan2"><a href="#四、atan2" class="headerlink" title="四、atan2()"></a>四、atan2()</h3><h4 id="描述-3"><a href="#描述-3" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double atan2(double y, double x) 返回以弧度表示的 y/x 的反正切。y 和 x 的值的符号决定了正确的象限。</p>
<h4 id="声明-3"><a href="#声明-3" class="headerlink" title="声明"></a>声明</h4><p>下面是 atan2() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double atan2(double y, double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-2"><a href="#参数-2" class="headerlink" title="参数"></a>参数</h4><p>x – 代表 x 轴坐标的浮点值。<br>y – 代表 y 轴坐标的浮点值。</p>
<h4 id="返回值-3"><a href="#返回值-3" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回以弧度表示的 y/x 的反正切，弧度区间为 [-pi,+pi]。</p>
<h4 id="实例-3"><a href="#实例-3" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 atan2() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">#define PI 3.14159265</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, y, ret, val;</span><br><span class="line"></span><br><span class="line">   x = -7.0;</span><br><span class="line">   y = 7.0;</span><br><span class="line">   val = 180.0 / PI;</span><br><span class="line"></span><br><span class="line">   ret = atan2 (y,x) * val;</span><br><span class="line">   printf(&quot;x = %lf, y = %lf 的反正切&quot;, x, y);</span><br><span class="line">   printf(&quot;是 %lf 度\n&quot;, ret);</span><br><span class="line">  </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>x = -7.000000, y = 7.000000 的反正切是 135.000000 度</p>
</blockquote>
<h3 id="五、cos"><a href="#五、cos" class="headerlink" title="五、cos()"></a>五、cos()</h3><h4 id="描述-4"><a href="#描述-4" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double cos(double x) 返回弧度角 x 的余弦。</p>
<h4 id="声明-4"><a href="#声明-4" class="headerlink" title="声明"></a>声明</h4><p>下面是 cos() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double cos(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-3"><a href="#参数-3" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值，代表了一个以弧度表示的角度。</p>
<h4 id="返回值-4"><a href="#返回值-4" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的余弦。</p>
<h4 id="实例-4"><a href="#实例-4" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 cos() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">#define PI 3.14159265</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret, val;</span><br><span class="line"></span><br><span class="line">   x = 60.0;</span><br><span class="line">   val = PI / 180.0;</span><br><span class="line">   ret = cos( x*val );</span><br><span class="line">   printf(&quot;%lf 的余弦是 %lf 度\n&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   x = 90.0;</span><br><span class="line">   val = PI / 180.0;</span><br><span class="line">   ret = cos( x*val );</span><br><span class="line">   printf(&quot;%lf 的余弦是 %lf 度\n&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>60.000000 的余弦是 0.500000 度<br>90.000000 的余弦是 0.000000 度</p>
</blockquote>
<h3 id="六、cosh"><a href="#六、cosh" class="headerlink" title="六、cosh()"></a>六、cosh()</h3><h4 id="描述-5"><a href="#描述-5" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double cosh(double x) 返回 x 的双曲余弦。</p>
<h4 id="声明-5"><a href="#声明-5" class="headerlink" title="声明"></a>声明</h4><p>下面是 cosh() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double cosh(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-4"><a href="#参数-4" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-5"><a href="#返回值-5" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的双曲余弦。</p>
<h4 id="实例-5"><a href="#实例-5" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 cosh() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x;</span><br><span class="line"></span><br><span class="line">   x = 0.5;</span><br><span class="line">   printf(&quot;%lf 的双曲余弦是 %lf\n&quot;, x, cosh(x));</span><br><span class="line"></span><br><span class="line">   x = 1.0;</span><br><span class="line">   printf(&quot;%lf 的双曲余弦是 %lf\n&quot;, x, cosh(x));</span><br><span class="line"></span><br><span class="line">   x = 1.5;</span><br><span class="line">   printf(&quot;%lf 的双曲余弦是 %lf\n&quot;, x, cosh(x));</span><br><span class="line"></span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>0.500000 的双曲余弦是 1.127626<br>1.000000 的双曲余弦是 1.543081<br>1.500000 的双曲余弦是 2.352410</p>
</blockquote>
<h3 id="七、sin"><a href="#七、sin" class="headerlink" title="七、sin()"></a>七、sin()</h3><h4 id="描述-6"><a href="#描述-6" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double sin(double x) 返回弧度角 x 的正弦。</p>
<h4 id="声明-6"><a href="#声明-6" class="headerlink" title="声明"></a>声明</h4><p>下面是 sin() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double sin(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-5"><a href="#参数-5" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值，代表了一个以弧度表示的角度。</p>
<h4 id="返回值-6"><a href="#返回值-6" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的正弦。</p>
<h4 id="实例-6"><a href="#实例-6" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 sin() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">#define PI 3.14159265</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret, val;</span><br><span class="line"></span><br><span class="line">   x = 45.0;</span><br><span class="line">   val = PI / 180;</span><br><span class="line">   ret = sin(x*val);</span><br><span class="line">   printf(&quot;%lf 的正弦是 %lf 度&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>45.000000 的正弦是 0.707107 度</p>
</blockquote>
<h3 id="八、sinh"><a href="#八、sinh" class="headerlink" title="八、sinh()"></a>八、sinh()</h3><h4 id="描述-7"><a href="#描述-7" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double sinh(double x) 返回 x 的双曲正弦。</p>
<h4 id="声明-7"><a href="#声明-7" class="headerlink" title="声明"></a>声明</h4><p>下面是 sinh() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double sinh(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-6"><a href="#参数-6" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-7"><a href="#返回值-7" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的双曲正弦。</p>
<h4 id="实例-7"><a href="#实例-7" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 sinh() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret;</span><br><span class="line">   x = 0.5;</span><br><span class="line"></span><br><span class="line">   ret = sinh(x);</span><br><span class="line">   printf(&quot;%lf 的双曲正弦是 %lf 度&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>0.500000 的双曲正弦是 0.521095 度</p>
</blockquote>
<h3 id="九、tanh"><a href="#九、tanh" class="headerlink" title="九、tanh()"></a>九、tanh()</h3><h4 id="描述-8"><a href="#描述-8" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double tanh(double x) 返回 x 的双曲正切。</p>
<p>####声明</p>
<p>下面是 tanh() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double tanh(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-7"><a href="#参数-7" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-8"><a href="#返回值-8" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的双曲正切。</p>
<h4 id="实例-8"><a href="#实例-8" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 tanh() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret;</span><br><span class="line">   x = 0.5;</span><br><span class="line"></span><br><span class="line">   ret = tanh(x);</span><br><span class="line">   printf(&quot;%lf 的双曲正切是 %lf 度&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>0.500000 的双曲正切是 0.462117 度</p>
</blockquote>
<h3 id="十、-exp"><a href="#十、-exp" class="headerlink" title="十、 exp()"></a>十、 exp()</h3><h4 id="描述-9"><a href="#描述-9" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double exp(double x) 返回 e 的 x 次幂的值。</p>
<h4 id="声明-8"><a href="#声明-8" class="headerlink" title="声明"></a>声明</h4><p>下面是 exp() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double exp(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-8"><a href="#参数-8" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-9"><a href="#返回值-9" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 e 的 x 次幂。</p>
<h4 id="实例-9"><a href="#实例-9" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 exp() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x = 0;</span><br><span class="line">  </span><br><span class="line">   printf(&quot;e 的 %lf 次幂是 %lf\n&quot;, x, exp(x));</span><br><span class="line">   printf(&quot;e 的 %lf 次幂是 %lf\n&quot;, x+1, exp(x+1));</span><br><span class="line">   printf(&quot;e 的 %lf 次幂是 %lf\n&quot;, x+2, exp(x+2));</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>e 的 0.000000 次幂是 1.000000<br>e 的 1.000000 次幂是 2.718282<br>e 的 2.000000 次幂是 7.389056</p>
</blockquote>
<h3 id="十一、frexp"><a href="#十一、frexp" class="headerlink" title="十一、frexp()"></a>十一、frexp()</h3><h4 id="描述-10"><a href="#描述-10" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double frexp(double x, int <em>exponent) 把浮点数 x 分解成尾数和指数。返回值是尾数，并将指数存入 exponent 中。所得的值是 x = mantissa </em> 2 ^ exponent。</p>
<h4 id="声明-9"><a href="#声明-9" class="headerlink" title="声明"></a>声明</h4><p>下面是 frexp() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double frexp(double x, int *exponent)</span><br></pre></td></tr></table></figure>
<h4 id="参数-9"><a href="#参数-9" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 要被计算的浮点值。</li>
<li>exponent – 指向一个对象的指针，该对象存储了指数的值。</li>
</ul>
<h4 id="返回值-10"><a href="#返回值-10" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回规格化小数。如果参数 x 不为零，则规格化小数是 x 的二次方，且它的绝对值范围从 1/2（包含）到 1（不包含）。如果 x 为零，则规格化小数是零，且零存储在 exp 中。</p>
<h4 id="实例-10"><a href="#实例-10" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 frexp() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x = 1024, fraction;</span><br><span class="line">   int e;</span><br><span class="line">   </span><br><span class="line">   fraction = frexp(x, &amp;e);</span><br><span class="line">   printf(&quot;x = %.2lf = %.2lf * 2^%d\n&quot;, x, fraction, e);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>x = 1024.00 = 0.50 * 2^11</p>
</blockquote>
<h3 id="十二、ldexp"><a href="#十二、ldexp" class="headerlink" title="十二、ldexp()"></a>十二、ldexp()</h3><h4 id="描述-11"><a href="#描述-11" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double ldexp(double x, int exponent) 返回 x 乘以 2 的 exponent 次幂。</p>
<h4 id="声明-10"><a href="#声明-10" class="headerlink" title="声明"></a>声明</h4><p>下面是 ldexp() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double ldexp(double x, int exponent)</span><br></pre></td></tr></table></figure>
<h4 id="参数-10"><a href="#参数-10" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 代表有效位数的浮点值。</li>
<li>exponent – 指数的值。</li>
</ul>
<h4 id="返回值-11"><a href="#返回值-11" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x * 2 exp。</p>
<h4 id="实例-11"><a href="#实例-11" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 ldexp() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret;</span><br><span class="line">   int n;</span><br><span class="line"></span><br><span class="line">   x = 0.65;</span><br><span class="line">   n = 3;</span><br><span class="line">   ret = ldexp(x ,n);</span><br><span class="line">   printf(&quot;%f * 2^%d = %f\n&quot;, x, n, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>0.650000 * 2^3 = 5.200000</p>
</blockquote>
<h3 id="十三、log"><a href="#十三、log" class="headerlink" title="十三、log()"></a>十三、log()</h3><h4 id="描述-12"><a href="#描述-12" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double log(double x) 返回 x 的自然对数（基数为 e 的对数）。</p>
<h4 id="声明-11"><a href="#声明-11" class="headerlink" title="声明"></a>声明</h4><p>下面是 log() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double log(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-11"><a href="#参数-11" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-12"><a href="#返回值-12" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的自然对数。</p>
<h4 id="实例-12"><a href="#实例-12" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 log() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret;</span><br><span class="line">   x = 2.7;</span><br><span class="line"></span><br><span class="line">   /* 计算 log(2.7) */</span><br><span class="line">   ret = log(x);</span><br><span class="line">   printf(&quot;log(%lf) = %lf&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>log(2.700000) = 0.993252</p>
</blockquote>
<h3 id="十四、log10"><a href="#十四、log10" class="headerlink" title="十四、log10()"></a>十四、log10()</h3><h4 id="描述-13"><a href="#描述-13" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double log10(double x) 返回 x 的常用对数（基数为 10 的对数）。</p>
<h4 id="声明-12"><a href="#声明-12" class="headerlink" title="声明"></a>声明</h4><p>下面是 log10() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double log10(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-12"><a href="#参数-12" class="headerlink" title="参数"></a>参数</h4><p>x – 浮点值。</p>
<h4 id="返回值-13"><a href="#返回值-13" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的常用对数，x 的值大于 0。</p>
<h4 id="实例-13"><a href="#实例-13" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 log10() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, ret;</span><br><span class="line">   x = 10000;</span><br><span class="line">  </span><br><span class="line">   /* 计算 log10(10000) */</span><br><span class="line">   ret = log10(x);</span><br><span class="line">   printf(&quot;log10(%lf) = %lf\n&quot;, x, ret);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>log10(10000.000000) = 4.000000</p>
</blockquote>
<h3 id="十五、modf"><a href="#十五、modf" class="headerlink" title="十五、modf()"></a>十五、modf()</h3><h4 id="描述-14"><a href="#描述-14" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double modf(double x, double *integer) 返回值为小数部分（小数点后的部分），并设置 integer 为整数部分。</p>
<h4 id="声明-13"><a href="#声明-13" class="headerlink" title="声明"></a>声明</h4><p>下面是 modf() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double modf(double x, double *integer)</span><br></pre></td></tr></table></figure>
<h4 id="参数-13"><a href="#参数-13" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 浮点值。</li>
<li>integer – 指向一个对象的指针，该对象存储了整数部分。</li>
</ul>
<h4 id="返回值-14"><a href="#返回值-14" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的小数部分，符号与 x 相同。</p>
<h4 id="实例-14"><a href="#实例-14" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 modf() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">#include&lt;stdio.h&gt;</span><br><span class="line">#include&lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   double x, fractpart, intpart;</span><br><span class="line"></span><br><span class="line">   x = 8.123456;</span><br><span class="line">   fractpart = modf(x, &amp;intpart);</span><br><span class="line"></span><br><span class="line">   printf(&quot;整数部分 = %lf\n&quot;, intpart);</span><br><span class="line">   printf(&quot;小数部分 = %lf \n&quot;, fractpart);</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>整数部分 = 8.000000<br>小数部分 = 0.123456</p>
</blockquote>
<h3 id="十六、pow"><a href="#十六、pow" class="headerlink" title="十六、pow()"></a>十六、pow()</h3><h4 id="描述-15"><a href="#描述-15" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double pow(double x, double y) 返回 x 的 y 次幂，即 xy。</p>
<h4 id="声明-14"><a href="#声明-14" class="headerlink" title="声明"></a>声明</h4><p>下面是 pow() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double pow(double x, double y)</span><br></pre></td></tr></table></figure>
<h4 id="参数-14"><a href="#参数-14" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 代表基数的浮点值。</li>
<li>y – 代表指数的浮点值。</li>
</ul>
<h4 id="返回值-15"><a href="#返回值-15" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的 y 次幂的结果。</p>
<h4 id="实例-15"><a href="#实例-15" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 pow() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   printf(&quot;值 8.0 ^ 3 = %lf\n&quot;, pow(8.0, 3));</span><br><span class="line"></span><br><span class="line">   printf(&quot;值 3.05 ^ 1.98 = %lf&quot;, pow(3.05, 1.98));</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>值 8.0 ^ 3 = 512.000000<br>值 3.05 ^ 1.98 = 9.097324 </p>
</blockquote>
<h3 id="十七、sqrt"><a href="#十七、sqrt" class="headerlink" title="十七、sqrt()"></a>十七、sqrt()</h3><h4 id="描述-16"><a href="#描述-16" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double sqrt(double x) 返回 x 的平方根。</p>
<h4 id="声明-15"><a href="#声明-15" class="headerlink" title="声明"></a>声明</h4><p>下面是 sqrt() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double sqrt(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-15"><a href="#参数-15" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 浮点值。</li>
</ul>
<h4 id="返回值-16"><a href="#返回值-16" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的平方根。</p>
<h4 id="实例-16"><a href="#实例-16" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 sqrt() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line"></span><br><span class="line">   printf(&quot;%lf 的平方根是 %lf\n&quot;, 4.0, sqrt(4.0) );</span><br><span class="line">   printf(&quot;%lf 的平方根是 %lf\n&quot;, 5.0, sqrt(5.0) );</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>4.000000 的平方根是 2.000000<br>5.000000 的平方根是 2.236068</p>
</blockquote>
<h3 id="十八、ceil"><a href="#十八、ceil" class="headerlink" title="十八、ceil()"></a>十八、ceil()</h3><h4 id="描述-17"><a href="#描述-17" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double ceil(double x) 返回大于或等于 x 的最小的整数值。</p>
<h4 id="声明-16"><a href="#声明-16" class="headerlink" title="声明"></a>声明</h4><p>下面是 ceil() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double ceil(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-16"><a href="#参数-16" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 浮点值。</li>
</ul>
<h4 id="返回值-17"><a href="#返回值-17" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回不小于 x 的最小整数值。</p>
<h4 id="实例-17"><a href="#实例-17" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 ceil() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   float val1, val2, val3, val4;</span><br><span class="line"></span><br><span class="line">   val1 = 1.6;</span><br><span class="line">   val2 = 1.2;</span><br><span class="line">   val3 = 2.8;</span><br><span class="line">   val4 = 2.3;</span><br><span class="line"></span><br><span class="line">   printf (&quot;value1 = %.1lf\n&quot;, ceil(val1));</span><br><span class="line">   printf (&quot;value2 = %.1lf\n&quot;, ceil(val2));</span><br><span class="line">   printf (&quot;value3 = %.1lf\n&quot;, ceil(val3));</span><br><span class="line">   printf (&quot;value4 = %.1lf\n&quot;, ceil(val4));</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>value1 = 2.0<br>value2 = 2.0<br>value3 = 3.0<br>value4 = 3.0</p>
</blockquote>
<h3 id="十九、fabs"><a href="#十九、fabs" class="headerlink" title="十九、fabs()"></a>十九、fabs()</h3><h4 id="描述-18"><a href="#描述-18" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double fabs(double x) 返回 x 的绝对值。</p>
<h4 id="声明-17"><a href="#声明-17" class="headerlink" title="声明"></a>声明</h4><p>下面是 fabs() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double fabs(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-17"><a href="#参数-17" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 浮点值。</li>
</ul>
<h4 id="返回值-18"><a href="#返回值-18" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x 的绝对值。</p>
<h4 id="实例-18"><a href="#实例-18" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 fabs() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   int a, b;</span><br><span class="line">   a = 1234;</span><br><span class="line">   b = -344;</span><br><span class="line">  </span><br><span class="line">   printf(&quot;%d 的绝对值是 %lf\n&quot;, a, fabs(a));</span><br><span class="line">   printf(&quot;%d 的绝对值是 %lf\n&quot;, b, fabs(b));</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>1234 的绝对值是 1234.000000<br>-344 的绝对值是 344.000000</p>
</blockquote>
<h3 id="二十、floor"><a href="#二十、floor" class="headerlink" title="二十、floor()"></a>二十、floor()</h3><h4 id="描述-19"><a href="#描述-19" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double floor(double x) 返回小于或等于 x 的最大的整数值。</p>
<h4 id="声明-18"><a href="#声明-18" class="headerlink" title="声明"></a>声明</h4><p>下面是 floor() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double floor(double x)</span><br></pre></td></tr></table></figure>
<h4 id="参数-18"><a href="#参数-18" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 浮点值。</li>
</ul>
<h4 id="返回值-19"><a href="#返回值-19" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回不大于 x 的最大整数值。</p>
<h4 id="实例-19"><a href="#实例-19" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 floor() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   float val1, val2, val3, val4;</span><br><span class="line"></span><br><span class="line">   val1 = 1.6;</span><br><span class="line">   val2 = 1.2;</span><br><span class="line">   val3 = 2.8;</span><br><span class="line">   val4 = 2.3;</span><br><span class="line"></span><br><span class="line">   printf(&quot;Value1 = %.1lf\n&quot;, floor(val1));</span><br><span class="line">   printf(&quot;Value2 = %.1lf\n&quot;, floor(val2));</span><br><span class="line">   printf(&quot;Value3 = %.1lf\n&quot;, floor(val3));</span><br><span class="line">   printf(&quot;Value4 = %.1lf\n&quot;, floor(val4));</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>Value1 = 1.0<br>Value2 = 1.0<br>Value3 = 2.0<br>Value4 = 2.0</p>
</blockquote>
<h3 id="二十一、fmod"><a href="#二十一、fmod" class="headerlink" title="二十一、fmod()"></a>二十一、fmod()</h3><h4 id="描述-20"><a href="#描述-20" class="headerlink" title="描述"></a>描述</h4><p>C 库函数 double fmod(double x, double y) 返回 x 除以 y 的余数。</p>
<h4 id="声明-19"><a href="#声明-19" class="headerlink" title="声明"></a>声明</h4><p>下面是 fmod() 函数的声明。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">double fmod(double x, double y)</span><br></pre></td></tr></table></figure>
<h4 id="参数-19"><a href="#参数-19" class="headerlink" title="参数"></a>参数</h4><ul>
<li>x – 代表分子的浮点值。</li>
<li>y – 代表分母的浮点值。</li>
</ul>
<h4 id="返回值-20"><a href="#返回值-20" class="headerlink" title="返回值"></a>返回值</h4><p>该函数返回 x/y 的余数。</p>
<h4 id="实例-20"><a href="#实例-20" class="headerlink" title="实例"></a>实例</h4><p>下面的实例演示了 fmod() 函数的用法。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;math.h&gt;</span><br><span class="line"></span><br><span class="line">int main ()</span><br><span class="line">&#123;</span><br><span class="line">   float a, b;</span><br><span class="line">   int c;</span><br><span class="line">   a = 9.2;</span><br><span class="line">   b = 3.7;</span><br><span class="line">   c = 2;</span><br><span class="line">   printf(&quot;%f / %d 的余数是 %lf\n&quot;, a, c, fmod(a,c));</span><br><span class="line">   printf(&quot;%f / %f 的余数是 %lf\n&quot;, a, b, fmod(a,b));</span><br><span class="line">   </span><br><span class="line">   return(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>让我们编译并运行上面的程序，这将产生以下结果：</p>
<blockquote>
<p>9.200000 / 2 的余数是 1.200000<br>9.200000 / 3.700000 的余数是 1.800000</p>
</blockquote>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/limh/tags/教程/" rel="tag"># 教程</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/limh/2015/03/06/cfunc06/" rel="next" title="locale.h">
                <i class="fa fa-chevron-left"></i> locale.h
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/limh/2015/03/08/cfunc08/" rel="prev" title="setjmp.h">
                setjmp.h <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/limh/images/avatar.jpg" alt="土逗牛肉">
            
              <p class="site-author-name" itemprop="name">土逗牛肉</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/limh/archives/">
              
                  <span class="site-state-item-count">255</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/limh/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/limh/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/limhGeek" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:1591054297@qq.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/f73b243e7cc9" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-user-circle-o"></i>简书</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#简介"><span class="nav-number">1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#库宏"><span class="nav-number">2.</span> <span class="nav-text">库宏</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#库函数"><span class="nav-number">3.</span> <span class="nav-text">库函数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#函数用例"><span class="nav-number">4.</span> <span class="nav-text">函数用例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#一、acos"><span class="nav-number">4.1.</span> <span class="nav-text">一、acos()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述"><span class="nav-number">4.1.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明"><span class="nav-number">4.1.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数"><span class="nav-number">4.1.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值"><span class="nav-number">4.1.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例"><span class="nav-number">4.1.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二、asin"><span class="nav-number">4.2.</span> <span class="nav-text">二、asin()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-1"><span class="nav-number">4.2.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-1"><span class="nav-number">4.2.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-1"><span class="nav-number">4.2.3.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-1"><span class="nav-number">4.2.4.</span> <span class="nav-text">实例</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-2"><span class="nav-number">4.2.5.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-2"><span class="nav-number">4.2.6.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-1"><span class="nav-number">4.2.7.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-2"><span class="nav-number">4.2.8.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-2"><span class="nav-number">4.2.9.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#四、atan2"><span class="nav-number">4.3.</span> <span class="nav-text">四、atan2()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-3"><span class="nav-number">4.3.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-3"><span class="nav-number">4.3.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-2"><span class="nav-number">4.3.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-3"><span class="nav-number">4.3.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-3"><span class="nav-number">4.3.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#五、cos"><span class="nav-number">4.4.</span> <span class="nav-text">五、cos()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-4"><span class="nav-number">4.4.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-4"><span class="nav-number">4.4.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-3"><span class="nav-number">4.4.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-4"><span class="nav-number">4.4.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-4"><span class="nav-number">4.4.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#六、cosh"><span class="nav-number">4.5.</span> <span class="nav-text">六、cosh()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-5"><span class="nav-number">4.5.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-5"><span class="nav-number">4.5.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-4"><span class="nav-number">4.5.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-5"><span class="nav-number">4.5.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-5"><span class="nav-number">4.5.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#七、sin"><span class="nav-number">4.6.</span> <span class="nav-text">七、sin()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-6"><span class="nav-number">4.6.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-6"><span class="nav-number">4.6.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-5"><span class="nav-number">4.6.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-6"><span class="nav-number">4.6.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-6"><span class="nav-number">4.6.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#八、sinh"><span class="nav-number">4.7.</span> <span class="nav-text">八、sinh()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-7"><span class="nav-number">4.7.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-7"><span class="nav-number">4.7.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-6"><span class="nav-number">4.7.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-7"><span class="nav-number">4.7.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-7"><span class="nav-number">4.7.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#九、tanh"><span class="nav-number">4.8.</span> <span class="nav-text">九、tanh()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-8"><span class="nav-number">4.8.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-7"><span class="nav-number">4.8.2.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-8"><span class="nav-number">4.8.3.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-8"><span class="nav-number">4.8.4.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十、-exp"><span class="nav-number">4.9.</span> <span class="nav-text">十、 exp()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-9"><span class="nav-number">4.9.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-8"><span class="nav-number">4.9.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-8"><span class="nav-number">4.9.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-9"><span class="nav-number">4.9.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-9"><span class="nav-number">4.9.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十一、frexp"><span class="nav-number">4.10.</span> <span class="nav-text">十一、frexp()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-10"><span class="nav-number">4.10.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-9"><span class="nav-number">4.10.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-9"><span class="nav-number">4.10.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-10"><span class="nav-number">4.10.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-10"><span class="nav-number">4.10.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十二、ldexp"><span class="nav-number">4.11.</span> <span class="nav-text">十二、ldexp()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-11"><span class="nav-number">4.11.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-10"><span class="nav-number">4.11.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-10"><span class="nav-number">4.11.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-11"><span class="nav-number">4.11.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-11"><span class="nav-number">4.11.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十三、log"><span class="nav-number">4.12.</span> <span class="nav-text">十三、log()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-12"><span class="nav-number">4.12.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-11"><span class="nav-number">4.12.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-11"><span class="nav-number">4.12.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-12"><span class="nav-number">4.12.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-12"><span class="nav-number">4.12.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十四、log10"><span class="nav-number">4.13.</span> <span class="nav-text">十四、log10()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-13"><span class="nav-number">4.13.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-12"><span class="nav-number">4.13.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-12"><span class="nav-number">4.13.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-13"><span class="nav-number">4.13.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-13"><span class="nav-number">4.13.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十五、modf"><span class="nav-number">4.14.</span> <span class="nav-text">十五、modf()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-14"><span class="nav-number">4.14.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-13"><span class="nav-number">4.14.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-13"><span class="nav-number">4.14.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-14"><span class="nav-number">4.14.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-14"><span class="nav-number">4.14.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十六、pow"><span class="nav-number">4.15.</span> <span class="nav-text">十六、pow()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-15"><span class="nav-number">4.15.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-14"><span class="nav-number">4.15.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-14"><span class="nav-number">4.15.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-15"><span class="nav-number">4.15.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-15"><span class="nav-number">4.15.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十七、sqrt"><span class="nav-number">4.16.</span> <span class="nav-text">十七、sqrt()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-16"><span class="nav-number">4.16.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-15"><span class="nav-number">4.16.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-15"><span class="nav-number">4.16.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-16"><span class="nav-number">4.16.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-16"><span class="nav-number">4.16.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十八、ceil"><span class="nav-number">4.17.</span> <span class="nav-text">十八、ceil()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-17"><span class="nav-number">4.17.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-16"><span class="nav-number">4.17.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-16"><span class="nav-number">4.17.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-17"><span class="nav-number">4.17.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-17"><span class="nav-number">4.17.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#十九、fabs"><span class="nav-number">4.18.</span> <span class="nav-text">十九、fabs()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-18"><span class="nav-number">4.18.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-17"><span class="nav-number">4.18.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-17"><span class="nav-number">4.18.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-18"><span class="nav-number">4.18.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-18"><span class="nav-number">4.18.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二十、floor"><span class="nav-number">4.19.</span> <span class="nav-text">二十、floor()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-19"><span class="nav-number">4.19.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-18"><span class="nav-number">4.19.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-18"><span class="nav-number">4.19.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-19"><span class="nav-number">4.19.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-19"><span class="nav-number">4.19.5.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二十一、fmod"><span class="nav-number">4.20.</span> <span class="nav-text">二十一、fmod()</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#描述-20"><span class="nav-number">4.20.1.</span> <span class="nav-text">描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#声明-19"><span class="nav-number">4.20.2.</span> <span class="nav-text">声明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参数-19"><span class="nav-number">4.20.3.</span> <span class="nav-text">参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#返回值-20"><span class="nav-number">4.20.4.</span> <span class="nav-text">返回值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#实例-20"><span class="nav-number">4.20.5.</span> <span class="nav-text">实例</span></a></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">土逗牛肉</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
	var str = GetUrlParam('height');
    if (str === '0'){
		document.getElementById('header').style.display = 'none';
		document.getElementById('comments').style.display = 'none';
		document.getElementById('footer').style.display = 'none';
		document.getElementsByClassName('post-footer').item(0).style.display = 'none'
	}
	
    function GetUrlParam(paraName) {
        var url = document.location.toString();
        var arrObj = url.split("?");

        if (arrObj.length > 1) {
            var arrPara = arrObj[1].split("&");
            var arr;

            for (var i = 0; i < arrPara.length; i++) {
                 arr = arrPara[i].split("=");

                if (arr != null && arr[0] === paraName) {
                    return arr[1];
                }
            }
            return "";
        } else {
            return "";
        }
    }
</script>









  












  
  
    <script type="text/javascript" src="/limh/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/limh/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/limh/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/limh/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/limh/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/limh/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
